import { requestApi } from "@/utils/request";
import type { LoginType, SendCodeType } from "@/types/login";
// 发送验证码接口
export const sendCodeAPI = async (email:string) => {
    return requestApi<SendCodeType>({
        url: '/vercode',
        method: 'POST',
        data:{
            email: email
        }
    })
}

// 验证码登录接口
export const codeLoginAPI = async (email:string, code:string) => {
    return requestApi<LoginType>({
        url: '/mobile-registration',
        method: 'POST',
        data:{
            email: email,
            code: code
        }
    })
}

// 密码登录接口
export const passwordLoginAPI = async (email:string, password:string) => {
    return requestApi<LoginType>({
        url: '/login',
        method: 'POST',
        data:{
            email: email,
            password: password
        }
    })
}

// 设置密码，修改密码
export const setPasswordAPI = async (email:string, code:string, password:string) => {
    return requestApi({
        url: '/upload-password',
        method: 'POST',
        data:{
            email: email,
            code: code,
            password: password
        }
    })
}